package vip.xiaozhao.paotui.intf.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import vip.xiaozhao.paotui.intf.entity.PaotuiDetailAudit;
import vip.xiaozhao.paotui.intf.enums.PaotuiGoingStatusEnum;

@Mapper
public interface PaoTuiDetailAuditMapper {

	@Insert("insert into xzVIP_paotui_audit(PaoUserId, FaBuUserId, PaotuiId, Status, Desc, Imgs,AddTime) " +
			"values(#{paoUserId},#{faBuUserId},#{paotuiId},#{status},#{desc},#{imgs},#{addTime})")
	@Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
	int insert(PaotuiDetailAudit audit);

	@Select(" select * from xzVIP_paotui_audit where UserId = #{userId} and PaotuiId = #{paotuiId} and Status = #{goingStatus}  order by id desc limit 1 ")
	PaotuiDetailAudit loadByUserIdAndGoingStatus(int userId, int paotuiId, int goingStatus) ;


	@Select(" select * from xzVIP_paotui_audit where UserId = #{userId} and PaotuiId = #{paotuiId}  order by id desc limit 1 ")
	PaotuiDetailAudit loadLatestByUserIdAndPaotuiId(int userId, int paotuiId);

}
